import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:flutter/material.dart';

class NormalBorderButton extends StatelessWidget {
  final String title;
  final VoidCallback onTap;
  final Color textColor;
  final Color backgroundColor;
  final Widget leading;
  final bool isFit;

  const NormalBorderButton({
    Key key,
    this.isFit,
    this.leading,
    this.title,
    this.onTap,
    this.textColor = aceBlueColor,
    this.backgroundColor = Colors.white,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final text = Text(
      title,
      style: TextStyle(
        color: textColor,
        fontSize: isFit == true ? getSp(16) : getSp(14),
        fontWeight: FontWeight.w700,
        height: isFit == true ? 24 / 16 : 20 / 14,
      ),
      textAlign: TextAlign.center,
    );
    final child = PressedOpacityButton(
      onPressed: onTap,
      disabledColor: Colors.white,
      color: backgroundColor,
      borderRadius: BorderRadius.circular(getDp(5)),
      border: Border.all(
        color: aceBlueColor,
        width: getDp(1),
      ),
      padding: EdgeInsets.symmetric(
        horizontal: getDp(10),
        vertical: getDp(8),
      ),
      child: text,
    );
    if (isFit == true) {
      return SizedBox(
        width: getDp(300),
        height: getDp(48),
        child: child,
      );
    } else {
      return child;
    }
  }
}
